Skip to content

Conversation

CPunisher
Copy link
Contributor

@CPunisher CPunisher commented Sep 30, 2025

Summary

This pr introduces some minor performance optimization for @rspack/browser:

  1. Disable TraceHookPlugin in browser.
  2. Introduce BufferOrBytes to avoid unnecessary data clone from Buffer to Vec<u8> in HttpUriPlugin.
  3. Move tokio runtime initialization from .init_array section to napi module_exports. It doesn't improve the performance for now, but it makes it possible to initialize javascript worker pool ahead of time in the future. Currently code in .init_array section is executed too early before the emnapi worker pool is prepared.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@CPunisher CPunisher requested a review from h-a-n-a September 30, 2025 03:25
@CPunisher CPunisher requested a review from hardfist as a code owner September 30, 2025 03:25
@Copilot Copilot AI review requested due to automatic review settings September 30, 2025 03:25
@github-actions github-actions bot added release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack. labels Sep 30, 2025
Copy link

netlify bot commented Sep 30, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit cd0f17b
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68db4da89d3d2b000802981f
😎 Deploy Preview https://deploy-preview-11795--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces minor performance optimizations for @rspack/browser by reducing unnecessary operations and reorganizing initialization code.

  • Disables TraceHookPlugin in browser environments to avoid unnecessary overhead
  • Introduces BufferOrBytes enum to prevent data cloning from Buffer to Vec<u8> in HTTP operations
  • Moves tokio runtime initialization from .init_array section to module_exports for better timing control

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/rspack/src/Compiler.ts Conditionally disables TraceHookPlugin for browser builds
crates/rspack_plugin_schemes/src/http_uri/http_cache.rs Introduces BufferOrBytes enum and optimizes HTTP response handling
crates/rspack_plugin_schemes/Cargo.toml Adds napi dependency for Buffer support
crates/rspack_binding_api/src/raw_options/raw_builtins/raw_http_uri.rs Updates HttpResponse to use Buffer directly
crates/rspack_binding_api/src/lib.rs Moves tokio runtime initialization from .init_array to module_exports

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

📦 Binary Size-limit

Comparing cd0f17b to chore(deps): update swc (#11747) by renovate[bot]

❌ Size increased by 8.00KB from 47.89MB to 47.89MB (⬆️0.02%)

Copy link

codspeed-hq bot commented Sep 30, 2025

CodSpeed Performance Report

Merging #11795 will not alter performance

Comparing 09-28-perf/browser (cd0f17b) with main (52ee813)

Summary

✅ 17 untouched

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant